<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../css/learning.css">
    <link rel="stylesheet" href="../css/navbar.css">
    <title>编程资源推荐</title>
</head>
<body>
    <div class="navbar">
        <div class="left">
            <a href="/">首页</a>
            <a href="/all_questions.html">编程题库</a>
        </div>
        <div class="center">
            <a href="/html/job_seek.html">求职</a>
            <a href="/html/learning.html">学习</a>
            <a href="/html/discuss.html">讨论</a>
            <a href="/html/question_bank.html">知识题库</a>
            <a href="/html/ai_qa.html">AI问答</a>
        </div>
        <div class="right">
            <a href="/html/register.html">注册</a>
            <a href="/html/login.html">登录</a>
            <a href="/html/userInfo.html" class="toRight">个人信息</a>
        </div>
    </div>

    <main>
        <section id="resources" class="section">
            <h2>编程资源推荐</h2>
            <p>提供各种编程学习资源，帮助您提高编程技能和解决学习中的难题。</p>
            <div class="add-article">
                <button onclick="window.location.href='/html/add_article.html'">添加文章</button>
            </div>            
            <!-- 资源类型选择 -->
            <div class="resource-type-selector">
                <label for="resource-type">资源类型:</label>
                <select id="resource-type" onchange="switchResourceType()">
                    <option value="articles">文章</option>
                    <option value="videos">视频</option>
                </select>
            </div>
            
            <div class="container">
                <!-- 分类选择 -->
                <div class="category-selector">
                    <button id="category-all" onclick="filterByCategory('all')" class="category-button">所有</button>
                    <button id="category-算法" onclick="filterByCategory('算法')" class="category-button">算法</button>
                    <button id="category-数据结构" onclick="filterByCategory('数据结构')" class="category-button">数据结构</button>
                    <button id="category-编程语言" onclick="filterByCategory('编程语言')" class="category-button">编程语言</button>
                    <button id="category-系统设计" onclick="filterByCategory('系统设计')" class="category-button">系统设计</button>
                    <button id="category-开发工具" onclick="filterByCategory('开发工具')" class="category-button">开发工具</button>
                </div>
                <!-- 搜索栏 -->
                <div class="search-bar">
                    <input type="text" id="search-input" placeholder="搜索关键词">
                    <button onclick="searchResources()">搜索</button>
                </div>
                
            </div>
           
            <!-- 文章列表 -->
            <div id="article-list" class="resource-list">
                <!-- 文章列表将通过 JavaScript 动态加载 -->
            </div>

            <!-- 视频列表 -->
            <div id="video-list" class="resource-list" style="display: none;">
                <!-- 视频列表将通过 JavaScript 动态加载 -->
            </div>
        </section>

        <!-- 每页条数选择 -->
        <div class="page-size-selector">
            <label for="page-size">每页显示:</label>
            <select id="page-size" onchange="changePageSize()">
                <option value="6">6条</option>
                <option value="9">9条</option>
                <option value="12">12条</option>
            </select>
        </div>

        <!-- 分页按钮 -->
        <div id="pagination" class="pagination">
            <!-- 分页按钮将通过 JavaScript 动态生成 -->
        </div>
    </main>

    <script src="../js/learning.js"></script>
</body>
</html>
